#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from flask import Flask,url_for,request
from flask_sqlalchemy import SQLAlchemy
# from flask_debugtoolbar import DebugToolbarExtension
 
from backend.database import app

from backend.blue_print import (
    index, detail, login, 
    register, retire,
    beginner, kw_search,logout,
    usetinymce,myrecord,ajax_handle
    )


app.debug = True
app.secret_key = "qazwsxedcrfv"
app.config["DEBUG_TB_INTERCEPT_REDIRECTS"] = False
# # 调试工具
# toolbar = DebugToolbarExtension()
# toolbar.init_app(app)


# 登录 
app.register_blueprint(login.bp)

# # 注册
app.register_blueprint(register.bp)

# # 找回密码
app.register_blueprint(retire.bp)
# # 退出登录
app.register_blueprint(logout.bp)
# 文章首页蓝图
app.register_blueprint(index.bp)


# 文章内容页面
app.register_blueprint(detail.bp,page_id=1)

# 小猿必读
app.register_blueprint(beginner.bp)

# 关键字查询
app.register_blueprint(kw_search.bp)

# 在线编辑器
app.register_blueprint(usetinymce.bp)

# 处理数据点赞，收藏，评论
app.register_blueprint(ajax_handle.bp)
# 我的记录
app.register_blueprint(myrecord.bp)


if __name__ == '__main__':
    cfg = {
    'port':1511,
    'host':'0.0.0.0'
    }
    app.run(**cfg)


